@@ -3,4 +3,5 @@ |
||
3 | 3 |
/.tmp |
4 | 4 |
/.sass-cache |
5 | 5 |
/bower_components |
6 |
-.DS-Store |
|
6 |
+.DS_Store |
|
7 |
+/app/.DS_Store |
@@ -0,0 +1,191 @@ |
||
1 |
+[ |
|
2 |
+ { |
|
3 |
+ "pageUrl" : "/rest-api-v1/get-missions", |
|
4 |
+ "slug" : "get-missions", |
|
5 |
+ "title" : "Mission List", |
|
6 |
+ "endpoint" : { |
|
7 |
+ "type" : "GET", |
|
8 |
+ "base" : "/missions" |
|
9 |
+ }, |
|
10 |
+ "description" : "You can get a list of missions and their details using this endpoint. Its also possible to do pagination and use filters to fine grain the returned results.", |
|
11 |
+ "variables" : [ |
|
12 |
+ { |
|
13 |
+ "name" : "count", |
|
14 |
+ "description" : "The number of items in the list", |
|
15 |
+ "variable_type" : "number" |
|
16 |
+ }, |
|
17 |
+ { |
|
18 |
+ "name" : "page", |
|
19 |
+ "description" : "The page of items to be return. <i>Example: if count is 10 and page is 3, then the items 20-30 will be returned.</i>", |
|
20 |
+ "variable_type" : "number" |
|
21 |
+ }, |
|
22 |
+ { |
|
23 |
+ "name" : "status", |
|
24 |
+ "description" : "Filter for the missions status. Status can be <code>Planning</code>, <code>Launched</code>, <code>Completed</code>, <code>Failed</code> or <code>Canceled</code>", |
|
25 |
+ "variable_type" : "string" |
|
26 |
+ } |
|
27 |
+ ], |
|
28 |
+ "examples" : [ |
|
29 |
+ { |
|
30 |
+ "name" : "cURL", |
|
31 |
+ "language" : "bash", |
|
32 |
+ "code" : "views/snipets/bash/get-missions-example.html" |
|
33 |
+ }, |
|
34 |
+ { |
|
35 |
+ "name" : "jQuery", |
|
36 |
+ "language" : "javascript", |
|
37 |
+ "code" : "views/snipets/jquery/get-missions-example.html" |
|
38 |
+ } |
|
39 |
+ ] |
|
40 |
+ }, |
|
41 |
+ { |
|
42 |
+ "pageUrl" : "/rest-api-v1/get-mission", |
|
43 |
+ "slug" : "get-mission", |
|
44 |
+ "title" : "Mission Details", |
|
45 |
+ "endpoint" : { |
|
46 |
+ "type" : "GET", |
|
47 |
+ "base" : "/missions/:slug" |
|
48 |
+ }, |
|
49 |
+ "description" : "Returns detailed information about a mission, including lists of all agents, all tasks and recent activity.", |
|
50 |
+ "variables" : [ |
|
51 |
+ { |
|
52 |
+ "name" : "slug", |
|
53 |
+ "description" : "A unique shortname identifier for the mission.", |
|
54 |
+ "variable_type" : "string" |
|
55 |
+ } |
|
56 |
+ ], |
|
57 |
+ "examples" : [ |
|
58 |
+ { |
|
59 |
+ "name" : "cURL", |
|
60 |
+ "language" : "bash", |
|
61 |
+ "code" : "views/snipets/bash/get-mission-example.html" |
|
62 |
+ }, |
|
63 |
+ { |
|
64 |
+ "name" : "jQuery", |
|
65 |
+ "language" : "javascript", |
|
66 |
+ "code" : "views/snipets/jquery/get-mission-example.html" |
|
67 |
+ } |
|
68 |
+ ] |
|
69 |
+ }, |
|
70 |
+ { |
|
71 |
+ "pageUrl" : "/rest-api-v1/post-mission", |
|
72 |
+ "slug" : "post-mission", |
|
73 |
+ "title" : "Post Mission", |
|
74 |
+ "endpoint" : { |
|
75 |
+ "type" : "POST", |
|
76 |
+ "base" : "/missions" |
|
77 |
+ }, |
|
78 |
+ "description" : "Creates a new mission on the system and returns it back. A user token is needed for this request.", |
|
79 |
+ "variables" : [ |
|
80 |
+ { |
|
81 |
+ "name" : "slug", |
|
82 |
+ "description" : "A shortname without spaces used as the mission identifier and url. This needs to be unique.", |
|
83 |
+ "variable_type" : "string" |
|
84 |
+ }, |
|
85 |
+ { |
|
86 |
+ "name" : "title", |
|
87 |
+ "description" : "The mission's title or name", |
|
88 |
+ "variable_type" : "string" |
|
89 |
+ } |
|
90 |
+ ] |
|
91 |
+ }, |
|
92 |
+ { |
|
93 |
+ "pageUrl" : "/rest-api-v1/launch-mission", |
|
94 |
+ "slug" : "launch-mission", |
|
95 |
+ "title" : "Launch Mission", |
|
96 |
+ "endpoint" : { |
|
97 |
+ "type" : "POST", |
|
98 |
+ "base" : "/missions/:slug/launch" |
|
99 |
+ } |
|
100 |
+ }, |
|
101 |
+ { |
|
102 |
+ "pageUrl" : "/rest-api-v1/delete-mission", |
|
103 |
+ "slug" : "delete-mission", |
|
104 |
+ "title" : "Delete Mission", |
|
105 |
+ "endpoint" : { |
|
106 |
+ "type" : "DELETE", |
|
107 |
+ "base" : "/missions/:slug" |
|
108 |
+ } |
|
109 |
+ }, |
|
110 |
+ { |
|
111 |
+ "pageUrl" : "/rest-api-v1/get-mission-agents", |
|
112 |
+ "slug" : "get-mission-agents", |
|
113 |
+ "title" : "Mission Agent List", |
|
114 |
+ "endpoint" : { |
|
115 |
+ "type" : "GET", |
|
116 |
+ "base" : "/missions/:slug/agents" |
|
117 |
+ } |
|
118 |
+ }, |
|
119 |
+ { |
|
120 |
+ "pageUrl" : "/rest-api-v1/get-mission-agent", |
|
121 |
+ "slug" : "get-mission-agent", |
|
122 |
+ "title" : "Mission Agent Details", |
|
123 |
+ "endpoint" : { |
|
124 |
+ "type" : "GET", |
|
125 |
+ "base" : "/missions/:slug/agents/:slug" |
|
126 |
+ } |
|
127 |
+ }, |
|
128 |
+ { |
|
129 |
+ "pageUrl" : "/rest-api-v1/post-mission-agent", |
|
130 |
+ "slug" : "post-mission-agent", |
|
131 |
+ "title" : "Post Mission Agent", |
|
132 |
+ "endpoint" : { |
|
133 |
+ "type" : "POST", |
|
134 |
+ "base" : "/missions/:slug/agents" |
|
135 |
+ } |
|
136 |
+ }, |
|
137 |
+ { |
|
138 |
+ "pageUrl" : "/rest-api-v1/delete-mission-agent", |
|
139 |
+ "slug" : "delete-mission-agent", |
|
140 |
+ "title" : "Delete Mission Agent", |
|
141 |
+ "endpoint" : { |
|
142 |
+ "type" : "DELETE", |
|
143 |
+ "base" : "/missions/:slug/agents/:slug" |
|
144 |
+ } |
|
145 |
+ }, |
|
146 |
+ { |
|
147 |
+ "pageUrl" : "/rest-api-v1/get-mission-tasks", |
|
148 |
+ "slug" : "get-mission-tasks", |
|
149 |
+ "title" : "Mission Task List", |
|
150 |
+ "endpoint" : { |
|
151 |
+ "type" : "GET", |
|
152 |
+ "base" : "/missions/:slug/tasks" |
|
153 |
+ } |
|
154 |
+ }, |
|
155 |
+ { |
|
156 |
+ "pageUrl" : "/rest-api-v1/get-mission-task", |
|
157 |
+ "slug" : "get-mission-task", |
|
158 |
+ "title" : "Mission Task Details", |
|
159 |
+ "endpoint" : { |
|
160 |
+ "type" : "GET", |
|
161 |
+ "base" : "/missions/:slug/tasks/:id" |
|
162 |
+ } |
|
163 |
+ }, |
|
164 |
+ { |
|
165 |
+ "pageUrl" : "/rest-api-v1/mark-mission-task", |
|
166 |
+ "slug" : "mark-mission-task", |
|
167 |
+ "title" : "Mark Mission Task", |
|
168 |
+ "endpoint" : { |
|
169 |
+ "type" : "POST", |
|
170 |
+ "base" : "/missions/:slug/tasks/:id/mark" |
|
171 |
+ } |
|
172 |
+ }, |
|
173 |
+ { |
|
174 |
+ "pageUrl" : "/rest-api-v1/post-mission-task", |
|
175 |
+ "slug" : "post-mission-task", |
|
176 |
+ "title" : "Post Mission Task", |
|
177 |
+ "endpoint" : { |
|
178 |
+ "type" : "POST", |
|
179 |
+ "base" : "/missions/:slug/tasks" |
|
180 |
+ } |
|
181 |
+ }, |
|
182 |
+ { |
|
183 |
+ "pageUrl" : "/rest-api-v1/delete-mission-task", |
|
184 |
+ "slug" : "delete-mission-task", |
|
185 |
+ "title" : "Delete Mission Task", |
|
186 |
+ "endpoint" : { |
|
187 |
+ "type" : "DELETE", |
|
188 |
+ "base" : "/missions/:slug/tasks/:id" |
|
189 |
+ } |
|
190 |
+ } |
|
191 |
+] |
@@ -21,6 +21,7 @@ |
||
21 | 21 |
<!-- endbuild --> |
22 | 22 |
<link rel="stylesheet" href="styles/tomorrow-night-eighties.css"> |
23 | 23 |
<script src="scripts/libs/highlight.min.js"></script> |
24 |
+ |
|
24 | 25 |
</head> |
25 | 26 |
<body ng-app="avalancheDocsApp"> |
26 | 27 |
<span us-spinner="{radius:30, width:8, length: 16}" spinner-key="spinner-1"></span> |
@@ -32,7 +33,7 @@ |
||
32 | 33 |
<div ui-view></div> |
33 | 34 |
|
34 | 35 |
|
35 |
- <!-- Google Analytics: change UA-XXXXX-X to be your site's ID --> |
|
36 |
+ <!-- Google Analytics: change UA-XXXXX-X to be your site's ID |
|
36 | 37 |
<script> |
37 | 38 |
!function(A,n,g,u,l,a,r){A.GoogleAnalyticsObject=l,A[l]=A[l]||function(){ |
38 | 39 |
(A[l].q=A[l].q||[]).push(arguments)},A[l].l=+new Date,a=n.createElement(g), |
@@ -42,7 +43,8 @@ |
||
42 | 43 |
ga('create', 'UA-XXXXX-X'); |
43 | 44 |
ga('send', 'pageview'); |
44 | 45 |
</script> |
45 |
- |
|
46 |
+ --> |
|
47 |
+ |
|
46 | 48 |
<!-- build:js(.) scripts/vendor.js --> |
47 | 49 |
<!-- bower:js --> |
48 | 50 |
<script src="bower_components/jquery/dist/jquery.js"></script> |
@@ -68,10 +70,12 @@ |
||
68 | 70 |
<script src="scripts/controllers/getting-started-ctrl.js"></script> |
69 | 71 |
<script src="scripts/controllers/rulebook-ctrl.js"></script> |
70 | 72 |
<script src="scripts/controllers/rest-api-v1-ctrl.js"></script> |
71 |
- <script src="scripts/controllers/get-missions-ctrl.js"></script> |
|
72 | 73 |
<script src="scripts/controllers/about.js"></script> |
73 | 74 |
<script src="scripts/services/oauth-service.js"></script> |
74 |
- <script src="scripts/services/get-data.js"></script> |
|
75 |
+ <script src="scripts/services/data-service.js"></script> |
|
76 |
+ <script src="scripts/services/page-service.js"></script> |
|
75 | 77 |
<!-- endbuild --> |
78 |
+ |
|
79 |
+ |
|
76 | 80 |
</body> |
77 | 81 |
</html> |
@@ -42,7 +42,7 @@ angular |
||
42 | 42 |
}) |
43 | 43 |
.state('rulebook', { |
44 | 44 |
url: "/rulebook", |
45 |
- templateUrl: 'views/rulebook.html', |
|
45 |
+ templateUrl: 'views/rulebook/index.html', |
|
46 | 46 |
controller: 'RulebookCtrl' |
47 | 47 |
}) |
48 | 48 |
.state('rulebook.intro', { |
@@ -56,19 +56,14 @@ angular |
||
56 | 56 |
controller: 'AboutCtrl' |
57 | 57 |
}) |
58 | 58 |
.state('rest-api-v1', { |
59 |
- url: "/rest-api-v1", |
|
59 |
+ url: "/rest-api-v1/:id", |
|
60 | 60 |
templateUrl: "views/rest-api-v1.html", |
61 |
- controller: 'RestAPIv1Ctrl' |
|
62 |
- }) |
|
63 |
- .state('rest-api-v1.get-missions', { |
|
64 |
- url: "/get-missions", |
|
65 |
- templateUrl: "views/get-missions.html", |
|
66 |
- controller: 'GetMissionsController' |
|
67 |
- }) |
|
68 |
- .state('rest-api-v1.get-mission', { |
|
69 |
- url: "/get-mission", |
|
70 |
- templateUrl: "views/get-mission.html", |
|
71 |
- controller: 'GetMissionsController' |
|
61 |
+ controller: 'RestAPIv1Ctrl', |
|
62 |
+ resolve: { |
|
63 |
+ pageData: function($stateParams, PageService) { |
|
64 |
+ return PageService.find($stateParams.id); |
|
65 |
+ }, |
|
66 |
+ } |
|
72 | 67 |
}) |
73 | 68 |
|
74 | 69 |
}]); |
@@ -8,58 +8,8 @@ |
||
8 | 8 |
* Controller of the avalancheDocsApp |
9 | 9 |
*/ |
10 | 10 |
angular.module('avalancheDocsApp') |
11 |
- .controller('GetMissionsController',['$scope', '$rootScope', 'GetData', 'usSpinnerService', 'OAuthService', function ($scope, $rootScope, GetData, usSpinnerService, OAuthService) { |
|
11 |
+ .controller('GetMissionsController',['$scope', '$rootScope', 'DataService', 'usSpinnerService', 'OAuthService', function ($scope, $rootScope, DataService, usSpinnerService, OAuthService) { |
|
12 | 12 |
|
13 |
- $scope.response = {}; |
|
14 |
- $scope.hideResult = true; |
|
15 |
- $scope.token = []; |
|
16 |
- $scope.token[0] = 'none'; |
|
17 |
- $scope.selectedToken = $scope.token[0]; |
|
18 |
- if(OAuthService.getToken() != ""){ |
|
19 |
- $scope.token[1] = OAuthService.getToken(); |
|
20 |
- $scope.selectedToken = $scope.token[1]; |
|
21 |
- } |
|
22 | 13 |
|
23 |
- GetData.get() |
|
24 |
- |
|
25 |
- $scope.call_api = function(url){ |
|
26 |
- usSpinnerService.spin('spinner-1'); |
|
27 |
- GetData.fetch(url, $scope.selectedToken); |
|
28 |
- } |
|
29 |
- $scope.hideResponse = function() { |
|
30 |
- $scope.hideResult = true; |
|
31 |
- } |
|
32 |
- $rootScope.$on('get-data:finished', function() { |
|
33 |
- if(!$scope.$$phase) { |
|
34 |
- $scope.$apply(function(){ |
|
35 |
- $scope.response = GetData.get(); |
|
36 |
- $scope.hideResult = false |
|
37 |
- }); |
|
38 |
- } else { |
|
39 |
- $scope.response = GetData.get(); |
|
40 |
- $scope.hideResult = false |
|
41 |
- } |
|
42 |
- usSpinnerService.stop('spinner-1'); |
|
43 |
- }); |
|
44 |
- |
|
45 |
- $rootScope.$on('auth:success', function() { |
|
46 |
- if(!$scope.$$phase) { |
|
47 |
- $scope.$apply(function(){ |
|
48 |
- $scope.token[1] = OAuthService.getToken(); |
|
49 |
- $scope.selectedToken = $scope.token[1]; |
|
50 |
- }); |
|
51 |
- } else { |
|
52 |
- $scope.token[1] = OAuthService.getToken(); |
|
53 |
- $scope.selectedToken = $scope.token[1]; |
|
54 |
- } |
|
55 |
- }); |
|
56 |
- |
|
57 |
- $scope.status = function(code) { |
|
58 |
- if(code == 200){ return "200 OK"} |
|
59 |
- if(code == 401){ return "401 Unauthorized"} |
|
60 |
- } |
|
61 |
- $scope.stringfy = function(data) { |
|
62 |
- return JSON.stringify(data, null, 4); |
|
63 |
- } |
|
64 | 14 |
|
65 | 15 |
}]) |
@@ -8,7 +8,12 @@ |
||
8 | 8 |
* Controller of the avalancheDocsApp |
9 | 9 |
*/ |
10 | 10 |
angular.module('avalancheDocsApp') |
11 |
- .controller('RestAPIv1Ctrl', ['$scope', '$location', '$cookies', '$window', function ($scope, $location, $cookies, $window) { |
|
11 |
+ .controller('RestAPIv1Ctrl', ['$scope', '$location', '$cookies', '$window', '$rootScope', 'DataService', 'usSpinnerService', 'OAuthService', 'PageService', function ($scope, $location, $cookies, $window, $rootScope, DataService, usSpinnerService, OAuthService, PageService) { |
|
12 |
+ |
|
13 |
+ $scope.pageData = PageService.get(); |
|
14 |
+ $scope.pageList = PageService.all(); |
|
15 |
+ console.log("Loading page " + $scope.pageData.title) |
|
16 |
+ |
|
12 | 17 |
|
13 | 18 |
$scope.isActive = function (viewLocation) { |
14 | 19 |
return viewLocation === $location.path(); |
@@ -26,4 +31,121 @@ angular.module('avalancheDocsApp') |
||
26 | 31 |
$window.location.href = 'http://localhost:5000/oauth/authorize?client_id=d514f58c234d69ce1405f00dbef842bd785c09201b35a746d87306f5e69fd02b&redirect_uri=http://localhost:9000/&response_type=code'; |
27 | 32 |
} |
28 | 33 |
|
34 |
+ |
|
35 |
+ // Initialize |
|
36 |
+ $scope.response = {}; |
|
37 |
+ $scope.hideResult = true; |
|
38 |
+ $scope.tokens = { availableOptions : [], selectedOption: []}; |
|
39 |
+ $scope.tokens.availableOptions[0] = 'none'; |
|
40 |
+ $scope.tokens.selectedToken = $scope.tokens.availableOptions[0]; |
|
41 |
+ $scope.data = {} |
|
42 |
+ if(OAuthService.getToken() != "" && OAuthService.getToken() != undefined){ |
|
43 |
+ $scope.tokens.availableOptions[1] = OAuthService.getToken(); |
|
44 |
+ $scope.tokens.selectedToken = $scope.tokens.availableOptions[1]; |
|
45 |
+ } |
|
46 |
+ DataService.getResponse() |
|
47 |
+ |
|
48 |
+ // API Calls |
|
49 |
+ $scope.getData = function(url){ |
|
50 |
+ usSpinnerService.spin('spinner-1'); |
|
51 |
+ DataService.get(url, $scope.processInputs(), $scope.tokens.selectedToken); |
|
52 |
+ } |
|
53 |
+ $scope.postData = function(url){ |
|
54 |
+ usSpinnerService.spin('spinner-1'); |
|
55 |
+ DataService.post(url, $scope.processInputs(), $scope.data, $scope.tokens.selectedToken); |
|
56 |
+ } |
|
57 |
+ |
|
58 |
+ $scope.processInputs = function(){ |
|
59 |
+ var inputs = []; |
|
60 |
+ for (var i = 0; i < $scope.pageData.variables.length; i++) { |
|
61 |
+ var field = $scope.pageData.variables[i].name; |
|
62 |
+ inputs[field] = $scope.pageData.variables[i].value; |
|
63 |
+ } |
|
64 |
+ return inputs; |
|
65 |
+ } |
|
66 |
+ |
|
67 |
+ |
|
68 |
+ $scope.hideResponse = function() { |
|
69 |
+ $scope.hideResult = true; |
|
70 |
+ } |
|
71 |
+ $rootScope.$on('get-data:finished', function() { |
|
72 |
+ if(!$scope.$$phase) { |
|
73 |
+ $scope.$apply(function(){ |
|
74 |
+ $scope.response = DataService.getResponse(); |
|
75 |
+ $scope.hideResult = false |
|
76 |
+ }); |
|
77 |
+ } else { |
|
78 |
+ $scope.response = DataService.getResponse(); |
|
79 |
+ $scope.hideResult = false |
|
80 |
+ } |
|
81 |
+ usSpinnerService.stop('spinner-1'); |
|
82 |
+ }); |
|
83 |
+ |
|
84 |
+ $rootScope.$on('auth:success', function() { |
|
85 |
+ if(!$scope.$$phase) { |
|
86 |
+ $scope.$apply(function(){ |
|
87 |
+ $scope.token[1] = OAuthService.getToken(); |
|
88 |
+ $scope.selectedToken = $scope.tokens.availableOptions[1]; |
|
89 |
+ }); |
|
90 |
+ } else { |
|
91 |
+ $scope.token[1] = OAuthService.getToken(); |
|
92 |
+ $scope.selectedToken = $scope.tokens.availableOptions[1]; |
|
93 |
+ } |
|
94 |
+ }); |
|
95 |
+ |
|
96 |
+ // Misc Functions |
|
97 |
+ |
|
98 |
+ $scope.fullURL = function(url){ |
|
99 |
+ return "http://localhost:5000/api" + url; |
|
100 |
+ } |
|
101 |
+ |
|
102 |
+ $scope.status = function(code) { |
|
103 |
+ if(code == 200){ |
|
104 |
+ return { |
|
105 |
+ code : "200 OK", |
|
106 |
+ info: "" |
|
107 |
+ }; |
|
108 |
+ } |
|
109 |
+ if(code == 201){ |
|
110 |
+ return { |
|
111 |
+ code : "201 Created", |
|
112 |
+ info: "The request has been fulfilled and resulted in a new resource being created." |
|
113 |
+ }; |
|
114 |
+ } |
|
115 |
+ if(code == 401){ |
|
116 |
+ return { |
|
117 |
+ code : "401 Unauthorized", |
|
118 |
+ info: "" |
|
119 |
+ }; |
|
120 |
+ } |
|
121 |
+ if(code == 422){ |
|
122 |
+ return { |
|
123 |
+ code : "422 Unprocessable Entity", |
|
124 |
+ info: "The request was well-formed but was unable to be followed due to semantic errors." |
|
125 |
+ }; |
|
126 |
+ } |
|
127 |
+ if(code == 500){ |
|
128 |
+ return { |
|
129 |
+ code : "500 Internal Server Error", |
|
130 |
+ info: "A generic error message, given when an unexpected condition was encountered and no more specific message is suitable." |
|
131 |
+ }; |
|
132 |
+ } |
|
133 |
+ } |
|
134 |
+ |
|
135 |
+ $scope.stringfy = function(data) { |
|
136 |
+ return JSON.stringify(data, null, 4); |
|
137 |
+ } |
|
138 |
+ |
|
139 |
+ $scope.callTypeBadge = function(call) { |
|
140 |
+ if(call == "GET"){ |
|
141 |
+ return "label label-success" |
|
142 |
+ } else if(call == "POST"){ |
|
143 |
+ return "label label-info" |
|
144 |
+ } else if(call == "DELETE"){ |
|
145 |
+ return "label label-danger" |
|
146 |
+ } else { |
|
147 |
+ return "label" |
|
148 |
+ } |
|
149 |
+ } |
|
150 |
+ |
|
29 | 151 |
}]); |
@@ -0,0 +1,68 @@ |
||
1 |
+angular.module('avalancheDocsApp') |
|
2 |
+.service('DataService', [ '$rootScope', '$http', function($rootScope, $http) { |
|
3 |
+ var response = {}; |
|
4 |
+ |
|
5 |
+ // GET |
|
6 |
+ this.get = function(url, inputs, token){ |
|
7 |
+ console.log("Requesting data from " + url); |
|
8 |
+ console.log(inputs); |
|
9 |
+ $http({ |
|
10 |
+ method: 'GET', |
|
11 |
+ url: 'http://localhost:5000/api' + url, |
|
12 |
+ headers: { 'Authorization' : "Bearer " + token }, |
|
13 |
+ params: inputs |
|
14 |
+ }).then(function(data, status, headers, config) { |
|
15 |
+ console.log("GET Request SUCCESSFULL") |
|
16 |
+ response.data = data.data; |
|
17 |
+ response.status = data.status; |
|
18 |
+ response.headers = data.headers; |
|
19 |
+ response.config = data.config; |
|
20 |
+ console.log(response) |
|
21 |
+ $rootScope.$broadcast('get-data:finished'); |
|
22 |
+ }, |
|
23 |
+ function(data, status) { |
|
24 |
+ console.log("GET Request FAILED") |
|
25 |
+ response.data = data.data; |
|
26 |
+ response.status = data.status; |
|
27 |
+ response.headers = data.headers; |
|
28 |
+ response.config = data.config; |
|
29 |
+ console.log(response) |
|
30 |
+ $rootScope.$broadcast('get-data:finished'); |
|
31 |
+ }); |
|
32 |
+ } |
|
33 |
+ |
|
34 |
+ // POST |
|
35 |
+ this.post = function(url, inputs, token){ |
|
36 |
+ console.log("Posting data to " + url); |
|
37 |
+ console.log(inputs); |
|
38 |
+ $http({ |
|
39 |
+ method: 'POST', |
|
40 |
+ url: 'http://localhost:5000/api' + url, |
|
41 |
+ headers: { 'Authorization' : "Bearer " + token }, |
|
42 |
+ params: inputs |
|
43 |
+ }).then(function(data, status, headers, config) { |
|
44 |
+ console.log("POST Request SUCCESSFULL") |
|
45 |
+ response.data = data.data; |
|
46 |
+ response.status = data.status; |
|
47 |
+ response.headers = data.headers; |
|
48 |
+ response.config = data.config; |
|
49 |
+ console.log(response) |
|
50 |
+ $rootScope.$broadcast('get-data:finished'); |
|
51 |
+ }, |
|
52 |
+ function(data, status) { |
|
53 |
+ console.log("POST Request FAILED") |
|
54 |
+ response.data = data.data; |
|
55 |
+ response.status = data.status; |
|
56 |
+ response.headers = data.headers; |
|
57 |
+ response.config = data.config; |
|
58 |
+ console.log(response) |
|
59 |
+ $rootScope.$broadcast('get-data:finished'); |
|
60 |
+ }); |
|
61 |
+ } |
|
62 |
+ |
|
63 |
+ // RESPONSE |
|
64 |
+ this.getResponse = function() { |
|
65 |
+ return response; |
|
66 |
+ } |
|
67 |
+ |
|
68 |
+}]) |
@@ -1,33 +0,0 @@ |
||
1 |
-angular.module('avalancheDocsApp') |
|
2 |
-.service('GetData', [ '$rootScope', '$http', function($rootScope, $http) { |
|
3 |
- var response = {}; |
|
4 |
- this.fetch = function(url, token){ |
|
5 |
- console.log("Requesting data from " + url) |
|
6 |
- $http({ |
|
7 |
- method: 'GET', |
|
8 |
- url: 'http://localhost:5000/api' + url, |
|
9 |
- headers: { 'Authorization' : "Bearer " + token } |
|
10 |
- }).then(function(data, status, headers, config) { |
|
11 |
- console.log("API Request SUCCESSFULL") |
|
12 |
- response.data = data.data; |
|
13 |
- response.status = data.status; |
|
14 |
- response.headers = data.headers; |
|
15 |
- response.config = data.config; |
|
16 |
- console.log(response) |
|
17 |
- $rootScope.$broadcast('get-data:finished'); |
|
18 |
- }, |
|
19 |
- function(data, status) { |
|
20 |
- console.log("API Request FAILED") |
|
21 |
- response.data = data.data; |
|
22 |
- response.status = data.status; |
|
23 |
- response.headers = data.headers; |
|
24 |
- response.config = data.config; |
|
25 |
- console.log(response) |
|
26 |
- $rootScope.$broadcast('get-data:finished'); |
|
27 |
- }); |
|
28 |
- } |
|
29 |
- this.get = function() { |
|
30 |
- return response; |
|
31 |
- } |
|
32 |
- |
|
33 |
-}]) |
@@ -0,0 +1,40 @@ |
||
1 |
+angular.module('avalancheDocsApp') |
|
2 |
+.service('PageService', [ '$rootScope', '$http', function($rootScope, $http) { |
|
3 |
+ var pages = []; |
|
4 |
+ var current_page = {}; |
|
5 |
+ |
|
6 |
+ this.find = function(page){ |
|
7 |
+ if( pages.length > 0) { |
|
8 |
+ searchForPage(page); |
|
9 |
+ } else { |
|
10 |
+ $http({ |
|
11 |
+ method: 'GET', |
|
12 |
+ url: 'data/rest-api-v1-pages.json' |
|
13 |
+ }).then(function(data) { |
|
14 |
+ pages = data.data; |
|
15 |
+ searchForPage(page); |
|
16 |
+ $rootScope.$broadcast('get-pages:finished'); |
|
17 |
+ }); |
|
18 |
+ } |
|
19 |
+ } |
|
20 |
+ |
|
21 |
+ this.get = function(){ |
|
22 |
+ return current_page; |
|
23 |
+ } |
|
24 |
+ |
|
25 |
+ this.all = function(){ |
|
26 |
+ return pages; |
|
27 |
+ } |
|
28 |
+ |
|
29 |
+ searchForPage = function(page) { |
|
30 |
+ //console.log("searching for " + page); |
|
31 |
+ for (var i = 0; i < pages.length; i++) { |
|
32 |
+ //console.log(pages[i].slug); |
|
33 |
+ if (pages[i].slug == page) { |
|
34 |
+ current_page = pages[i]; |
|
35 |
+ return current_page; |
|
36 |
+ } |
|
37 |
+ } |
|
38 |
+ } |
|
39 |
+ |
|
40 |
+}]) |
@@ -1,81 +0,0 @@ |
||
1 |
- |
|
2 |
- |
|
3 |
-<div class="api-endpoint"> |
|
4 |
- <h2 style="margin-bottom: 0px;">Mission Details</h2> |
|
5 |
- <small class="api-endpoint"><span class="label label-success">GET</span> /missions/:id</small> |
|
6 |
- <hr> |
|
7 |
- |
|
8 |
- <h5 class="top-spacer">Variables</h5> |
|
9 |
- |
|
10 |
- <table class="table table-bordered top-spacer"> |
|
11 |
- <tr> |
|
12 |
- <th>password</th> |
|
13 |
- <td>Security password for accessing the mission</td> |
|
14 |
- </tr> |
|
15 |
- </table> |
|
16 |
- |
|
17 |
- <h5>Description</h5> |
|
18 |
- |
|
19 |
- <p class="top-spacer">Returns detailed information about a mission, including lists of all agents, all tasks and recent activity.</p> |
|
20 |
- |
|
21 |
- <h5>Examples</h5> |
|
22 |
- <tabset class="top-spacer"> |
|
23 |
- <tab heading="cURL"> |
|
24 |
- <div hljs language="bash">curl http://avalanche.network/api/missions/</div> |
|
25 |
- </tab> |
|
26 |
- <tab heading="jQuery"> |
|
27 |
- <div hljs language="javascript" include="'views/snipets/jquery/get-missions-example.html'" onload="hljs"></div> |
|
28 |
- </tab> |
|
29 |
- </tabset> |
|
30 |
- |
|
31 |
- <h5>Responses</h5> |
|
32 |
- <tabset class="top-spacer"> |
|
33 |
- <tab heading="Try It"> |
|
34 |
- <form class="top-spacer"> |
|
35 |
- <div class="row"> |
|
36 |
- <div class="col-sm-8"> |
|
37 |
- <input type="text" class="form-control" id="exampleInputAmount" placeholder="http://avalanche.network/api/missions" disabled> |
|
38 |
- </div> |
|
39 |
- <button type="submit" class="btn btn-success" ng-click="call_api('/missions')">Try It</button> |
|
40 |
- <button type="submit" class="btn" ng-click="hideResponse()" ng-hide="hideResult">Hide</button> |
|
41 |
- </div> |
|
42 |
- </form> |
|
43 |
- <div class="table-responsive col-sm-12" ng-hide="hideResult"> |
|
44 |
- <table class="table table-bordered top-spacer" > |
|
45 |
- <tr> |
|
46 |
- <td colspan="2">{{status(response.status)}}</td> |
|
47 |
- </tr> |
|
48 |
- <tr> |
|
49 |
- <td colspan="2"><json-formatter json="response.data" open="1" style="overflow-x: hidden;"></json-formatter></td> |
|
50 |
- </tr> |
|
51 |
- <tr> |
|
52 |
- <td>Method</td> |
|
53 |
- <td>{{response.config.method}}</i></td> |
|
54 |
- </tr> |
|
55 |
- <tr> |
|
56 |
- <td>Request Headers</td> |
|
57 |
- <td>{{response.config.headers.Accept}}</td> |
|
58 |
- </tr> |
|
59 |
- <tr> |
|
60 |
- <td>URL</td> |
|
61 |
- <td>{{response.config.url}}</td> |
|
62 |
- </tr> |
|
63 |
- <tr> |
|
64 |
- <td>Status</td> |
|
65 |
- <td>{{status(response.status)}}</td> |
|
66 |
- </tr> |
|
67 |
- <tr > |
|
68 |
- <td style="min-width: 150px;">Response Headers</td> |
|
69 |
- <td>{{stringfy(response.headers())}}</td> |
|
70 |
- </tr> |
|
71 |
- </table> |
|
72 |
- </div> |
|
73 |
- </tab> |
|
74 |
- <tab heading="Success Example"> |
|
75 |
- <div hljs language="json" include="'views/snipets/json/get-missions-success-response-example.html'"></div> |
|
76 |
- </tab> |
|
77 |
- <tab heading="Failure Example"> |
|
78 |
- <div hljs language="json" include="'views/snipets/json/get-missions-failure-response-example.html'"></div> |
|
79 |
- </tab> |
|
80 |
- </tabset> |
|
81 |
-</div> |
@@ -1,104 +0,0 @@ |
||
1 |
- |
|
2 |
- |
|
3 |
-<div class="api-endpoint"> |
|
4 |
- <h2 style="margin-bottom: 0px;">Mission List</h2> |
|
5 |
- <small class="api-endpoint"><span class="label label-success">GET</span> /missions/{{test}}</small> |
|
6 |
- <hr> |
|
7 |
- |
|
8 |
- <h5 class="top-spacer">Variables</h5> |
|
9 |
- |
|
10 |
- <table class="table table-bordered top-spacer"> |
|
11 |
- <tr> |
|
12 |
- <th>count</th> |
|
13 |
- <td>The number of items in the list</td> |
|
14 |
- </tr> |
|
15 |
- <tr> |
|
16 |
- <th>page</th> |
|
17 |
- <td>The page of items to be return. <i>Example: if count is 10 and page is 3, then the items 20-30 will be returned.</i></td> |
|
18 |
- </tr> |
|
19 |
- <tr> |
|
20 |
- <th>status</th> |
|
21 |
- <td>Filter for the missions status. Status can be <code>Planning</code>, <code>Launched</code>, <code>Completed</code> or <code>Failed</code>, <code>Canceled</code>. |
|
22 |
- </table> |
|
23 |
- |
|
24 |
- <h5>Description</h5> |
|
25 |
- |
|
26 |
- <p class="top-spacer">You can get a list of missions and their details using this endpoint. Its also possible to do pagination and use filters to fine grain the returned results.</p> |
|
27 |
- |
|
28 |
- <h5>Examples</h5> |
|
29 |
- <tabset class="top-spacer"> |
|
30 |
- <tab heading="cURL"> |
|
31 |
- <div hljs language="bash">curl http://avalanche.network/api/missions/</div> |
|
32 |
- </tab> |
|
33 |
- <tab heading="jQuery"> |
|
34 |
- <div hljs language="javascript" include="'views/snipets/jquery/get-missions-example.html'" onload="hljs"></div> |
|
35 |
- </tab> |
|
36 |
- </tabset> |
|
37 |
- |
|
38 |
- <h5>Responses</h5> |
|
39 |
- <tabset class="top-spacer"> |
|
40 |
- <tab heading="Try It"> |
|
41 |
- <form class="top-spacer"> |
|
42 |
- <fieldset class="form-group"> |
|
43 |
- <div class="row"> |
|
44 |
- <div class="col-sm-8"> |
|
45 |
- <label for="api-token-select">OAuth Access Token</label> |
|
46 |
- <select class="form-control " id="api-token-select" ng-options="option for option in token track by token" ng-model="selectedToken" style="height: 38px;"> |
|
47 |
- <option ng-repeat="option in token" value="{{option}}">{{option}}</option> |
|
48 |
- </select> |
|
49 |
- </div> |
|
50 |
- <div class="col-sm-4"> |
|
51 |
- <br> |
|
52 |
- <a ng-click="authorizeUser()" class="btn btn-secondary-outline btn-sm" role="button" style="margin-top:10px;">Get Token</a> |
|
53 |
- </div> |
|
54 |
- </div> |
|
55 |
- </fieldset> |
|
56 |
- <div class="row"> |
|
57 |
- <div class="col-sm-8"> |
|
58 |
- <input type="text" class="form-control" id="exampleInputAmount" placeholder="http://avalanche.network/api/missions" disabled> |
|
59 |
- </div> |
|
60 |
- <div class="col-sm-4"> |
|
61 |
- <button type="submit" class="btn btn-success" ng-click="call_api('/missions')">Try It</button> |
|
62 |
- <button type="submit" class="btn" ng-click="hideResponse()" ng-hide="hideResult">Hide</button> |
|
63 |
- </div> |
|
64 |
- </div> |
|
65 |
- </form> |
|
66 |
- <div class="table-responsive col-sm-12" ng-hide="hideResult"> |
|
67 |
- <table class="table table-bordered top-spacer" > |
|
68 |
- <tr> |
|
69 |
- <td colspan="2">{{status(response.status)}}</td> |
|
70 |
- </tr> |
|
71 |
- <tr> |
|
72 |
- <td colspan="2"><json-formatter json="response.data" open="1" style="overflow-x: hidden;"></json-formatter></td> |
|
73 |
- </tr> |
|
74 |
- <tr> |
|
75 |
- <td>Method</td> |
|
76 |
- <td>{{response.config.method}}</i></td> |
|
77 |
- </tr> |
|
78 |
- <tr> |
|
79 |
- <td>Request Headers</td> |
|
80 |
- <td>{{response.config.headers.Accept}}</td> |
|
81 |
- </tr> |
|
82 |
- <tr> |
|
83 |
- <td>URL</td> |
|
84 |
- <td>{{response.config.url}}</td> |
|
85 |
- </tr> |
|
86 |
- <tr> |
|
87 |
- <td>Status</td> |
|
88 |
- <td>{{status(response.status)}}</td> |
|
89 |
- </tr> |
|
90 |
- <tr > |
|
91 |
- <td style="min-width: 150px;">Response Headers</td> |
|
92 |
- <td>{{stringfy(response.headers())}}</td> |
|
93 |
- </tr> |
|
94 |
- </table> |
|
95 |
- </div> |
|
96 |
- </tab> |
|
97 |
- <tab heading="Success Example"> |
|
98 |
- <div hljs language="json" include="'views/snipets/json/get-missions-success-response-example.html'"></div> |
|
99 |
- </tab> |
|
100 |
- <tab heading="Failure Example"> |
|
101 |
- <div hljs language="json" include="'views/snipets/json/get-missions-failure-response-example.html'"></div> |
|
102 |
- </tab> |
|
103 |
- </tabset> |
|
104 |
-</div> |
@@ -6,7 +6,7 @@ |
||
6 | 6 |
<li class="active"><a ui-sref="getting-started">Getting Started<span class="sr-only">(current)</span></a></li> |
7 | 7 |
<li><a ui-sref="rulebook.intro">Rulebook</a></li> |
8 | 8 |
<li><a ui-sref="styleguide">Styleguide</a></li> |
9 |
- <li><a ui-sref="rest-api-v1.get-missions">Restfull API v1 </a></li> |
|
9 |
+ <li><a ui-sref="rest-api-v1({ id: 'get-missions' })">Restfull API v1 </a></li> |
|
10 | 10 |
<li><a ui-sref="realtime-api-v1">Realtime API v1</a></li> |
11 | 11 |
</ul> |
12 | 12 |
</div> |
@@ -0,0 +1,14 @@ |
||
1 |
+<div class="row"> |
|
2 |
+ <div class="col-sm-9"> |
|
3 |
+ <fieldset class="form-group"> |
|
4 |
+ <label for="exampleInputEmail1">API Endpoint</label> |
|
5 |
+ <input type="text" class="form-control" id="endpoint" placeholder="{{fullURL(pageData.endpoint.base)}}" disabled> |
|
6 |
+ </fieldset> |
|
7 |
+ </div> |
|
8 |
+ <div class="col-sm-3"> |
|
9 |
+ <fieldset class="form-group" style="margin-top: 35px;"> |
|
10 |
+ <button type="submit" class="btn btn-success btn-sm" ng-click="getData(pageData.endpoint.base)">Test</button> |
|
11 |
+ <button type="submit" class="btn btn-sm" ng-click="hideResponse()" ng-hide="hideResult">Hide</button> |
|
12 |
+ </fieldset> |
|
13 |
+ </div> |
|
14 |
+</div> |
@@ -0,0 +1,30 @@ |
||
1 |
+<div class="table-responsive col-sm-12" ng-hide="hideResult"> |
|
2 |
+ <table class="table table-bordered top-spacer" > |
|
3 |
+ <tr> |
|
4 |
+ <td colspan="2">{{status(response.status).code}}</td> |
|
5 |
+ </tr> |
|
6 |
+ <tr> |
|
7 |
+ <td colspan="2"><json-formatter json="response.data" open="1" style="overflow-x: hidden;"></json-formatter></td> |
|
8 |
+ </tr> |
|
9 |
+ <tr> |
|
10 |
+ <td>Method</td> |
|
11 |
+ <td>{{response.config.method}}</i></td> |
|
12 |
+ </tr> |
|
13 |
+ <tr> |
|
14 |
+ <td>Request Headers</td> |
|
15 |
+ <td>{{response.config.headers.Accept}}</td> |
|
16 |
+ </tr> |
|
17 |
+ <tr> |
|
18 |
+ <td>URL</td> |
|
19 |
+ <td>{{response.config.url}}</td> |
|
20 |
+ </tr> |
|
21 |
+ <tr> |
|
22 |
+ <td>Status</td> |
|
23 |
+ <td>{{status(response.status).code}} - {{status(response.status).info}}</td> |
|
24 |
+ </tr> |
|
25 |
+ <tr > |
|
26 |
+ <td style="min-width: 150px;">Response Headers</td> |
|
27 |
+ <td>{{stringfy(response.headers())}}</td> |
|
28 |
+ </tr> |
|
29 |
+ </table> |
|
30 |
+</div> |
@@ -0,0 +1,13 @@ |
||
1 |
+<fieldset class="form-group"> |
|
2 |
+ <div class="row"> |
|
3 |
+ <div class="col-sm-9"> |
|
4 |
+ <label for="api-token-select">OAuth Access Token</label> |
|
5 |
+ <select class="form-control " id="api-token-select" ng-options="option for option in tokens.availableOptions track by option" ng-model="tokens.selectedToken" style="height: 38px;"> |
|
6 |
+ </select> |
|
7 |
+ </div> |
|
8 |
+ <div class="col-sm-3"> |
|
9 |
+ <br> |
|
10 |
+ <a ng-click="authorizeUser()" class="btn btn-secondary-outline btn-sm" role="button" style="margin-top:10px;">Get Token</a> |
|
11 |
+ </div> |
|
12 |
+ </div> |
|
13 |
+</fieldset> |
@@ -6,99 +6,64 @@ |
||
6 | 6 |
<li><a ui-sref="getting-started">Getting Started</a></li> |
7 | 7 |
<li><a ui-sref="rulebook.intro">Rulebook</a></li> |
8 | 8 |
<li><a ui-sref="styleguide">Styleguide</a></li> |
9 |
- <li class="active"><a ui-sref="rest-api-v1.get-missions">Restfull API v1 <span class="sr-only">(current)</span></a></li> |
|
9 |
+ <li class="active"><a ui-sref="rest-api-v1({ id: 'get-missions' })">Restfull API v1 <span class="sr-only">(current)</span></a></li> |
|
10 | 10 |
<li><a ui-sref="realtime-api-v1">Realtime API v1</a></li> |
11 | 11 |
</ul> |
12 | 12 |
</div> |
13 | 13 |
<div class="col-sm-4 col-md-3 col-md-offset-2 col-sm-offset-3 sidebar sidebar-secondary"> |
14 | 14 |
<ul class="nav nav-sidebar"> |
15 |
- <li ng-class="{ active: isActive('/rest-api-v1/get-missions')}"> |
|
16 |
- <a ui-sref="rest-api-v1.get-missions"> |
|
17 |
- <small class="api-endpoint"><span class="label label-success">GET</span><samp>/missions/</samp></small> |
|
18 |
- <p class="endpoint-description"><i>Mission list</i></p> |
|
19 |
- </a> |
|
20 |
- </li> |
|
21 |
- <li ng-class="{ active: isActive('/rest-api-v1/get-mission')}"> |
|
22 |
- <a ui-sref="rest-api-v1.get-mission"> |
|
23 |
- <small class="api-endpoint"><span class="label label-success">GET</span><samp>/missions/:id</samp></small> |
|
24 |
- <p class="endpoint-description"><i>View mission details</i></p> |
|
25 |
- </a> |
|
26 |
- </li> |
|
27 |
- <li ng-class="{ active: isActive('/rest-api-v1/post-mission')}"> |
|
28 |
- <a ui-sref="rest-api-v1.post-mission"> |
|
29 |
- <small class="api-endpoint"><span class="label label-info">POST</span><samp>/missions/:id</samp></small> |
|
30 |
- <p class="endpoint-description"><i>Post or update a mission</i></p> |
|
31 |
- </a> |
|
32 |
- </li> |
|
33 |
- <li ng-class="{ active: isActive('/rest-api-v1/launch-mission')}"> |
|
34 |
- <a ui-sref="rest-api-v1.launch-mission"> |
|
35 |
- <small class="api-endpoint"><span class="label label-info">POST</span><samp>/missions/:id/launch</samp></small> |
|
36 |
- <p class="endpoint-description"><i>Launch mission</i></p> |
|
37 |
- </a> |
|
38 |
- </li> |
|
39 |
- <li ng-class="{ active: isActive('/rest-api-v1/delete-mission')}"> |
|
40 |
- <a ui-sref="rest-api-v1.delete-mission"> |
|
41 |
- <small class="api-endpoint"><span class="label label-danger">DELETE</span><samp>/missions/:id</samp></small> |
|
42 |
- <p class="endpoint-description"><i>Remove mission</i></p> |
|
43 |
- </a> |
|
44 |
- </li> |
|
45 |
- <li ng-class="{ active: isActive('/rest-api-v1/get-mission-agents')}"> |
|
46 |
- <a ui-sref="rest-api-v1.get-mission-agents"> |
|
47 |
- <small class="api-endpoint"><span class="label label-success">GET</span><samp>/missions/:id/agents</samp></small> |
|
48 |
- <p class="endpoint-description"><i>Mission agents list</i></p> |
|
49 |
- </a> |
|
50 |
- </li> |
|
51 |
- <li ng-class="{ active: isActive('/rest-api-v1/get-mission-agent')}"> |
|
52 |
- <a ui-sref="rest-api-v1.get-mission-agent"> |
|
53 |
- <small class="api-endpoint"><span class="label label-success">GET</span><samp>/missions/:id/agents/:id</samp></small> |
|
54 |
- <p class="endpoint-description"><i>Mission agent details</i></p> |
|
55 |
- </a> |
|
56 |
- </li> |
|
57 |
- <li ng-class="{ active: isActive('/rest-api-v1/post-mission-agent')}"> |
|
58 |
- <a ui-sref="rest-api-v1.post-mission-agent"> |
|
59 |
- <small class="api-endpoint"><span class="label label-info">POST</span><samp>/missions/:id/agents/:id</samp></small> |
|
60 |
- <p class="endpoint-description"><i>Post or update mission agent</i></p> |
|
61 |
- </a> |
|
62 |
- </li> |
|
63 |
- <li ng-class="{ active: isActive('/rest-api-v1/delete-mission-agent')}"> |
|
64 |
- <a ui-sref="rest-api-v1.delete-mission-agent"> |
|
65 |
- <small class="api-endpoint"><span class="label label-danger">DELETE</span><samp>/missions/:id/agents/:id</samp></small> |
|
66 |
- <p class="endpoint-description"><i>Remove agent from mission</i></p> |
|
67 |
- </a> |
|
68 |
- </li> |
|
69 |
- <li ng-class="{ active: isActive('/rest-api-v1/get-mission-tasks')}"> |
|
70 |
- <a ui-sref="rest-api-v1.get-mission-tasks"> |
|
71 |
- <small class="api-endpoint"><span class="label label-success">GET</span><samp>/missions/:id/tasks</samp></small> |
|
72 |
- <p class="endpoint-description"><i>Mission tasks list</i></p> |
|
73 |
- </a> |
|
74 |
- </li> |
|
75 |
- <li ng-class="{ active: isActive('/rest-api-v1/get-mission-task')}"> |
|
76 |
- <a ui-sref="rest-api-v1.get-mission-task"> |
|
77 |
- <small class="api-endpoint"><span class="label label-success">GET</span><samp>/missions/:id/task/:id</samp></small> |
|
78 |
- <p class="endpoint-description"><i>Mission task details</i></p> |
|
79 |
- </a> |
|
80 |
- </li> |
|
81 |
- <li ng-class="{ active: isActive('/rest-api-v1/mark-mission-task')}"> |
|
82 |
- <a ui-sref="rest-api-v1.mark-mission-task"> |
|
83 |
- <small class="api-endpoint"><span class="label label-info">POST</span><samp>/missions/:id/task/:id/mark</samp></small> |
|
84 |
- <p class="endpoint-description"><i>Mark mission task</i></p> |
|
85 |
- </a> |
|
86 |
- </li> |
|
87 |
- <li ng-class="{ active: isActive('/rest-api-v1/post-mission-task')}"> |
|
88 |
- <a ui-sref="rest-api-v1.post-mission-task"> |
|
89 |
- <small class="api-endpoint"><span class="label label-info">POST</span><samp>/missions/:id/task/:id</samp></small> |
|
90 |
- <p class="endpoint-description"><i>Post or update mission task</i></p> |
|
91 |
- </a> |
|
92 |
- </li> |
|
93 |
- <li ng-class="{ active: isActive('/rest-api-v1/delete-mission-task')}"> |
|
94 |
- <a ui-sref="rest-api-v1.delete-mission-task"> |
|
95 |
- <small class="api-endpoint"><span class="label label-danger">DELETE</span><samp>/missions/:id/task/:id</samp></small> |
|
96 |
- <p class="endpoint-description"><i>Remove mission task</i></p> |
|
15 |
+ <li ng-repeat="page in pageList" ng-class="{ active: isActive(page.pageUrl)}"> |
|
16 |
+ <a ui-sref="rest-api-v1({ id: page.slug })"> |
|
17 |
+ <small class="api-endpoint"><span ng-class="callTypeBadge(page.endpoint.type)">{{page.endpoint.type}}</span><samp>{{page.endpoint.base}}</samp></small> |
|
18 |
+ <p class="endpoint-description"><i>{{page.title}}</i></p> |
|
97 | 19 |
</a> |
98 | 20 |
</li> |
21 |
+ |
|
99 | 22 |
</ul> |
100 | 23 |
</div> |
101 |
- <div class="col-sm-5 col-sm-offset-7 col-md-7 col-md-offset-5 main" ui-view> |
|
24 |
+ <div class="col-sm-5 col-sm-offset-7 col-md-7 col-md-offset-5 main"> |
|
25 |
+ <div class="api-endpoint"> |
|
26 |
+ <h2 style="margin-bottom: 0px;">{{pageData.title}}</h2> |
|
27 |
+ <small class="api-endpoint"><span ng-class="callTypeBadge(pageData.endpoint.type)">{{pageData.endpoint.type}}</span> {{pageData.endpoint.base}}</small> |
|
28 |
+ <hr> |
|
29 |
+ |
|
30 |
+ <div ng-if="pageData.description != undefined"> |
|
31 |
+ <p ng-bind-html="pageData.description"></p> |
|
32 |
+ </div> |
|
33 |
+ |
|
34 |
+ <div ng-if="pageData.variables.length > 0"> |
|
35 |
+ <h5 class="top-spacer">Variables</h5> |
|
36 |
+ <table class="table table-bordered top-spacer"> |
|
37 |
+ <tr ng-repeat="variable in pageData.variables"> |
|
38 |
+ <th>{{variable.name}}</th> |
|
39 |
+ <td ng-bind-html="variable.description"></td> |
|
40 |
+ </tr> |
|
41 |
+ </table> |
|
42 |
+ </div> |
|
43 |
+ |
|
44 |
+ <div ng-if="pageData.examples.length > 0"> |
|
45 |
+ <h5>Examples</h5> |
|
46 |
+ <tabset class="top-spacer"> |
|
47 |
+ <tab ng-repeat="example in pageData.examples" heading="{{example.name}}"> |
|
48 |
+ <div hljs language="{{example.language}}" include="example.code" onload="hljs"></div> |
|
49 |
+ </tab> |
|
50 |
+ </tabset> |
|
51 |
+ </div> |
|
52 |
+ |
|
53 |
+ <h5>Responses</h5> |
|
54 |
+ <form class="top-spacer"> |
|
55 |
+ <ng-include src="'views/helpers/api-token-field.html'"></ng-include> |
|
56 |
+ <div class="row"> |
|
57 |
+ <div class="col-sm-3" ng-repeat="variable in pageData.variables"> |
|
58 |
+ <fieldset class="form-group"> |
|
59 |
+ <label for="{{variable.name}}">{{variable.name}}</label> |
|
60 |
+ <input type="text" class="form-control" id="{{variable.name}}" placeholder="{{variable.placeholder}}" ng-model="variable.value"> |
|
61 |
+ </fieldset> |
|
62 |
+ </div> |
|
63 |
+ </div> |
|
64 |
+ <ng-include src="'views/helpers/api-endpoint-field.html'"></ng-include> |
|
65 |
+ </form> |
|
66 |
+ <ng-include src="'views/helpers/api-response.html'"></ng-include> |
|
102 | 67 |
|
103 | 68 |
</div> |
104 | 69 |
</div> |
@@ -0,0 +1 @@ |
||
1 |
+curl http://avalanche.network/api/missions/example-mission-name |
@@ -0,0 +1 @@ |
||
1 |
+curl http://avalanche.network/api/missions/ |
@@ -0,0 +1,3 @@ |
||
1 |
+$.get(' http://avalanche.network/api/missions/example-mission-name', function(data) { |
|
2 |
+ alert(data); |
|
3 |
+}); |